package org.rbac.content.configure;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.rbac.content.define.RbacKeyDefine;
import org.rbac.content.define.RbacKeyDefine.keys;

/**
 * 
*  <pre>    
* 类名称：RbacConfigure 
* 类描述：   程序配置信息
* 创建人：陈国祥   (kingschan)
* 创建时间：2015-7-6 上午9:08:14   
* 修改人：Administrator   
* 修改时间：2015-7-6 上午9:08:14   
* 修改备注：   
* @version V1.0
* </pre>
 */
public class RbacConfigure {
    private Logger log = Logger.getLogger(RbacConfigure.class);
    //配置映射
    private static Map<String, Object> configure;
    private static RbacConfigure instance;
    private RbacConfigure(){}
    public synchronized static RbacConfigure getInstance(){
        if (null==instance) {
            instance=new RbacConfigure();
            configure=new HashMap<String, Object>();
        }
        return instance;
    }
    /**
     * 设置
     * @param key
     * @param value
     */
    public void set(keys key,Object value){
        log.debug(String.format("设置配置【%s】值【%s】", RbacKeyDefine.getKey(key),value));
        configure.put(RbacKeyDefine.getKey(key), value);
    }
    /**
     * 得到
     * @param key
     * @return
     */
    public Object get(keys key){
        return configure.get(RbacKeyDefine.getKey(key));
    }
}
